import 'ad_error.dart';

/// FileName ad_listener
/// @Author zhuqingfang
/// @Date 2022/9/19 4:16 下午
/// @Description ad_listener

typedef AdEventCallBack<Ad> = void Function(Ad ad);

typedef AdLoadErrorCallback<Ad,AdError> = void Function(Ad ad,LoadAdError adError);
typedef AdShowErrorCallback<Ad,AdError> = void Function(Ad ad,ShowAdError showAdError);

class AdLoadCallback<Ad> {
  const AdLoadCallback({required this.onAdLoaded, required this.onAdFailLoad});

  final AdEventCallBack<Ad> onAdLoaded;
  final AdLoadErrorCallback<Ad,LoadAdError> onAdFailLoad;
}

class ContentCallback<Ad> {
  ContentCallback(
      {required this.onAdShow,
      required this.onAdDismiss,
      required this.onAdClick});

  final AdEventCallBack<Ad> onAdShow;
  final AdEventCallBack<Ad> onAdDismiss;
  final AdEventCallBack<Ad> onAdClick;
}

class RewardVideoContentCallback<Ad> extends ContentCallback<Ad> {
  RewardVideoContentCallback(
      {required onAdShow,
      required onAdDismiss,
      required onAdClick,
      required this.onAdReward,
      required this.onPlayError})
      : super(
            onAdShow: onAdShow, onAdDismiss: onAdDismiss, onAdClick: onAdClick);
  final AdEventCallBack<Ad> onAdReward;
  final AdShowErrorCallback<Ad,ShowAdError> onPlayError;
}
